import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();

            System.out.println(f(n));
        }
    }

    private static long f(int n) {
        if (n == 2) {
            return 1;
        }
        if (n < 2) {
            return 0;
        }
        if (n == 3) {
            return 2;
        }
        return (n-1)*((f(n-1)+f(n-2)));
    }
}
